const templateRoutes = require('./routes.json')

function TemplateRoute (routes) {
  this.data = routes
}

TemplateRoute.prototype = {
  getLink: function (frontTemplate) {
    const data = this.data
    const arr = data.filter(res => res.frontTemplate === frontTemplate)
    if (arr.length !== 0) return arr[0].link
    else return data[0].link
  }
}

export default new TemplateRoute(templateRoutes)
